﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

/// <summary>
/// Mod载入的原初列表监听，当通过构造函数访问这个类时就会自动尝试获取所有mod
/// </summary>
public static class ModLister
{
    static public List<ModMetaData> mods { get;private set; }
    static ModLister()
    {
        mods = new List<ModMetaData>();
        RebuildModList();

    }
    /// <summary>
    /// 原本就是空
    /// </summary>
    public static void EnsureInit()
    {

    }

    public static void RebuildModList()
    {
        //Data数据中代表官方mod
        foreach (DirectoryInfo data in new DirectoryInfo(MiaoFilePaths.OfficialModsFolderPath).GetDirectories())
        {
            ModMetaData modMetaData = new ModMetaData(data, official: true);
            mods.Add(modMetaData);
        }
        //载入非官方
        foreach (DirectoryInfo data in new DirectoryInfo(MiaoFilePaths.ModsFolderPath).GetDirectories())
        {
            ModMetaData modMetaData = new ModMetaData(data);
            mods.Add(modMetaData);
        }
    }
}

